import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
//前置全局导航守卫
router.beforeEach((to,from,next)=>{
  // console.log("beforeEach--------------------------");
  console.log(to,from);
  if(to.matched.length === 1){
    document.title = to.meta.title;
  }else{
    document.title = to.matched[0].meta.title + '-' + to.matched[1].meta.title;
  }
  
  next();
})
//后置导航守卫
router.afterEach((to,from)=>{
  // console.log("afterEach-----------------------------");
})